<?php echo $this->Html->script(array('jquery.quicksearch','actions'),$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));?>
<?php echo $this->Html->css(array('actions','messages','events.lists','lastminute-left','search-left','form'),null,array('inline'=>false));?>


<div class="content">
	<div class="left-column">
		<?php echo $this->Yachts->search_form_left();?>		
		<div class="clr"></div>	
		<?php echo $this->Yachts->lastminute(2);?>
		<div class="clr"></div>	
	</div>
	
	
	<div class="middle-column main-column">
		<div class="box corners">
			<h2><?php  __("Message");?></h2>
			<div class="actions">
				<ul>
					<li><?php echo $this->Html->link(__("New", true), array( 'action' => 'add'),array('escape'=>false,'title'=>__("New", true),'class'=>'new-message')); ?></li>
					<li><?php echo $this->Html->link(__("Inbox", true), array( 'action' => 'index',1),array('escape'=>false,'title'=>__("Inbox", true),'class'=>'inbox')); ?></li>
					<li><?php echo $this->Html->link(__("Outbox", true), array( 'action' => 'index',2),array('escape'=>false,'title'=>__("Outbox", true),'class'=>'outbox')); ?></li>				
					<li><?php echo $this->Html->link(__("Archives", true), array( 'action' => 'index',3),array('escape'=>false,'title'=>__("Archives", true),'class'=>'archive')); ?></li>				
					<li><?php echo $this->Html->link(__("Deleted", true), array( 'action' => 'index',4),array('escape'=>false,'title'=>__("Deleted", true),'class'=>'deleted')); ?></li>
					<li><?php echo $this->Html->link(__("Edit", true), array( 'action' => 'edit',$message['Message']['id']),array('escape'=>false,'title'=>__("Edit", true),'class'=>'edit')); ?></li>
					<li><?php echo $this->Html->link(__("Delete", true), array( 'action' => 'delete',$message['Message']['id']),array('escape'=>false,'title'=>__("Delete", true),'class'=>'delete'), sprintf(__("Are you sure you want to delete # %s?", true), $message['Message']['id'])); ?></li>
				
				</ul>
			</div>
			<div class="clr"></div>
			<dl><?php $i = 0; $class = ' class="altrow"';?>
				
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('From'); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php
						$from_user_id = $message['Message'][(($message['Message']['status']==1 || $message['Message']['status']== 3 || $message['Message']['status']== 41)?'fromto_':'').'user_id'];
						$name = (isset($users[$from_user_id]['name'])) ? $users[$from_user_id]['name'] : '';
						
						
						echo $this->Html->link($name, array('action' => 'add', $message['Message']['user_id'])); ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('To'); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php 
						$to_user_id = $message['Message'][(($message['Message']['status']==2 || $message['Message']['status']==42)?'fromto_':'').'user_id'];
						$name = (isset($users[$to_user_id]['name'])) ? $users[$to_user_id]['name'] : '';
						echo $this->Html->link($name, array( 'action' => 'add', $message['Message']['fromto_user_id'])); ?>
					&nbsp;
				</dd>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Date'); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $message['Message']['added']; ?>
					&nbsp;
				</dd>
								
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Subject"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $message['Message']['name']; ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Content'); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $message['Message']['content']; ?>
					&nbsp;
				</dd>
			</dl>
			<div class="clr"></div>
		</div>
		
		<div class="clr"></div>	
	</div>			
	<div class="right-column">
		<?php echo $this->element('user_main_left_menu')?>
	</div>		
	<div class="clr"></div>
</div>	
<div class="clr"></div>	
			

